/*
 * AddressDerivator.java
 *
 * Created on 6 f�vrier 2008, 10:32
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */
package br.great.functionalCore;

//import arcweb.address.Address;
//import arcweb.ReverseGeocoder;
//import br.great.functionalCore.Address.GeonamesAddressService;
import java.util.logging.Level;
import java.util.logging.Logger;
import br.great.beans.*;
import br.great.functionalCore.Adress.AddressServiceDelegate;
//import br.great.functionalCore.Address.AddressServiceDelegate;

/**
 *
 * @author defautce
 */
public class AddressDerivator {

//    private static Address derivatedAddress;

//    public Address getDerivatedAddress() {
//        return this.derivatedAddress;
//    }

    public Address deriveAddress(Point coor) {
        try {
//            ReverseGeocoder reverseGeocoder = ReverseGeocoder.create();
//            GeonamesAddressService ga = new GeonamesAddressService();
//            derivatedAddress = ga.findAddress(coor);
            AddressServiceDelegate addressServiceDelegate = new AddressServiceDelegate();
            return  addressServiceDelegate.getAddressByCoordinates(coor);
        } catch (Exception ex) {
            ex.printStackTrace();
            Logger.getLogger(AddressDerivator.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } 
    }

//    public static void main(String[] args) {
//        Point coor = new Point();
//        coor.setLatitude(45);
//        coor.setLongitude(5);
//        Address ad = deriveAddress(coor);
//        System.out.print("city : " + ad.getNameCity());
//    }
}
